#include<iostream>
using namespace std;
class A{
	public :
	    virtual void print_message()const{
		   cout<<"i am A"<<endl;
	   }
};
class B : public A{
	public :
	   void print_message()const{
		   cout<<"i am B"<<endl;
	   }
};
class C : public B{
	public :
	   void print_message()const{
		   cout<<"i am C"<<endl;
	   }
};
int main(void){
	A *a_ptr = new A();
	A *b_ptr = new B();
	A *c_ptr = new C();
	
	a_ptr->print_message();//A 拥有A的虚函数表 输出：i am A
	b_ptr->print_message();//B 拥有A的虚函数表 输出：i am B
	c_ptr->print_message();//C 拥有A的虚函数表 输出：i am C
	return 0;
}